package com.li.drug.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.li.drug.utils.DateUtil;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 药品
 */
@Data
@TableName(value = "druginfo")
public class Druginfo implements Serializable {
    //主键
    @TableField(value = "id")
    @TableId(value = "id",type = IdType.AUTO)  //主键自增
    private Integer id;

    private String name;
    private String supplier;

    @DateTimeFormat(pattern = "yyyy-MM-dd")  //时间格式转换
    private Date producttime;
    private String warrenty; //保质期（月）
    private String number;
    private Float price;
    private Integer stock;

    //日期格式转换
    public String getDateFormat() {
        return DateUtil.dateConvert(producttime);
    }
}
